<template>
  <div class="home">
    <a-button type="primary" @click="bindLogin">登录</a-button>
  </div>
</template>

<script>
export default {
  name: 'LoginIndex',
  data() {
    return {
      redirectUrl: ''
    }
  },
  methods: {
    bindLogin() {
      this.$store.dispatch('user/handleLogin', 'ahhahaha')

      this.$router.push({
        path: this.redirectUrl || this.$config.homePath
      })
    }
  },
  mounted() {
    const { redirect } = this.$route.query

    this.redirectUrl = redirect || ''
  }
}
</script>
